package yja.gzw.app.adapter

import android.content.Context
import android.content.Intent
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import yja.gzw.app.R
import yja.gzw.app.activity.FankuchenggongActivity
import yja.gzw.app.adapter.FensiAdapter.OnItemClickListener
import yja.gzw.app.model.bean.Feedbackfankui
import yja.gzw.app.model.bean.FocusDatafs

class FankuiAdapter (private val context: Context, private val list: List<Feedbackfankui>): RecyclerView.Adapter<RecyclerView.ViewHolder>(){
    private var view: View?=null
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
        view= LayoutInflater.from(parent.context).inflate(R.layout.item_view_fankuijingdu,parent,false)
        return ViewHodeView(view!!)
    }

    override fun getItemCount(): Int {
       return list.size
    }

    override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
        if(holder is ViewHodeView){

            holder.neirong.text=list[position].content
            holder.shijian.text=list[position].createtime_text
            if(list[position].type=="1"){
                holder.leixing.text="功能异常类型"
            }else{
                holder.leixing.text="产品建议类型"

            }
            holder.zhuangtai.text=list[position].status_text

            holder.itemView.setOnClickListener {

                val inten=Intent(context, FankuchenggongActivity::class.java)
                inten.putExtra("id",list[position].id.toString())
                context.startActivity(inten)

            }


        }
    }

    inner class ViewHodeView(itemView: View):RecyclerView.ViewHolder(itemView){
        val leixing: TextView =itemView.findViewById(R.id.leixing)
        val neirong: TextView =itemView.findViewById(R.id.neirong)
        val shijian: TextView =itemView.findViewById(R.id.shijian)
        val zhuangtai: TextView =itemView.findViewById(R.id.zhuangtai)

    }



}